let jsbk = {};
jsbk = {
    getDate:function(date){
        let datas = new Date(date);
        let dataWeek  = datas.getDay();
        let week = '';
        switch(dataWeek) {
            case 1:
                week = "星期一"
                break;
            case 2:
                week = "星期二"
                break;
            case 3:
                week = "星期三"
                break;
            case 4:
                week = "星期四"
                break;
            case 5:
                week = "星期五"
                break;
            case 6:
                week = "星期六"
                break;
             default:
                week = "星期日"
        } 
        return week
    },
    getMatchRT:function(gid,rst){
        var rs = "";
        if(gid == 90 || gid == 85 || gid == 72 || gid == 87 || gid == 92 || gid == 94 || gid == 95){
            rs = rst.replace(/3/g, "胜");
            rs = rs.replace(/1/g, "平");
            rs = rs.replace(/0/g, "负");
        } else if(gid == 86 || gid == 91) {
            rs = rst.substring(0,1) + ":" + rst.substring(1,2);
            rs = rs.replace(/9:9/g, "平其他");
            rs = rs.replace(/9:0/g, "胜其他");
            rs = rs.replace(/0:9/g, "负其他");
        } else if(gid == 88){
            rs = rst.replace(/3/g, "上单");
            rs = rs.replace(/2/g, "上双");
            rs = rs.replace(/1/g, "下单");
            rs = rs.replace(/0/g, "下双");
        } else if(gid == 89 || gid == 93){
            rs = rst.replace(/7/g, "7+");
        } else if(gid == 96){
            rs = rst.replace(/11/g, "主负1-5");
            rs = rs.replace(/15/g, "主负21-25");
            rs = rs.replace(/16/g, "主负26+");
            rs = rs.replace(/01/g, "主胜1-5");
            rs = rs.replace(/02/g, "主胜6-10");
            rs = rs.replace(/03/g, "主胜11-15");
            rs = rs.replace(/04/g, "主胜16-20");
            rs = rs.replace(/05/g, "主胜21-25");
            rs = rs.replace(/06/g, "主胜26+");
            rs = rs.replace(/12/g, "主负6-10");
            rs = rs.replace(/13/g, "主负11-15");
            rs = rs.replace(/14/g, "主负16-20");
        } else if(gid == 97){
            rs = rst.replace(/3/g, "大分");
            rs = rs.replace(/0/g, "小分");
        }
        return rs;
    },
    getMatchRS:function(gid,hs,vs,hss,vss,lose){
        var rs = "";
        if(gid == 90){
            if(parseFloat(hs) > parseFloat(vs)){
                rs = "3";
            } else if(parseFloat(hs) < parseFloat(vs)){
                rs = "0";
            } else {
                rs = "1";
            }
        } else if(gid == 85 || gid == 72){
            if(parseFloat(hs) + parseFloat(lose) > parseFloat(vs)){
                rs = "3";
            } else if(parseFloat(hs) + parseFloat(lose) < parseFloat(vs)){
                rs = "0";
            } else {
                rs = "1";
            }
        } else if(gid == 86) {
            rs = hs + "" + vs;
            if (parseFloat(hs) > parseFloat(vs)) {
                if (parseFloat(hs) == parseFloat(vs) && parseFloat(hs) > 3) {
                    rs = "99";
                }
                if (parseFloat(hs) == 4 && parseFloat(vs) > 2) {
                    rs = "90";
                }
                if (parseFloat(hs) > 4) {
                    rs = "90";
                }
            } else if (parseFloat(hs) == parseFloat(vs)) {
                if (parseFloat(hs) > 3) {
                    rs = "99";
                }
            } else {
                if (parseFloat(vs) == 4 && parseFloat(hs) > 2) {
                    rs = "09";
                }
                if (parseFloat(vs) > 4) {
                    rs = "09";
                }
            }
        } else if(gid == 91) {
            rs = hs + "" + vs;
            if (parseFloat(hs) > parseFloat(vs)) {
                if (parseFloat(hs) == parseFloat(vs) && parseFloat(hs) > 3) {
                    rs = "99";
                }
                if (parseFloat(hs) == 4 && parseFloat(vs) == 3) {
                    rs = "90";
                }
                if (parseFloat(hs) == 5 && parseFloat(vs) > 2) {
                    rs = "90";
                }
                if (parseFloat(hs) > 5) {
                    rs = "90";
                }
            } else if (parseFloat(hs) == parseFloat(vs)) {
                if (parseFloat(hs) > 3) {
                    rs = "99";
                }
            } else {
                if (parseFloat(vs) == 4 && parseFloat(hs) == 3) {
                    rs = "09";
                }
                if (parseFloat(vs) == 5 && parseFloat(hs) > 2) {
                    rs = "09";
                }
                if (parseFloat(vs) > 5) {
                    rs = "09";
                }
            }
        } else if(gid == 87 || gid == 92){
            if (parseFloat(hss) > parseFloat(vss)) {//胜
                if (parseFloat(hs) > parseFloat(vs)) {
                    rs = "33";
                } else if (parseFloat(hs) == parseFloat(vs)) {
                    rs = "31";
                } else {
                    rs = "30";
                }
            } else if (parseFloat(hss) == parseFloat(vss)) {//平
                if (parseFloat(hs) > parseFloat(vs)) {
                    rs = "13";
                } else if (parseFloat(hs) == parseFloat(vs)) {
                    rs = "11";
                } else {
                    rs = "10";
                }
            } else {
                if (parseFloat(hs) > parseFloat(vs)) {
                    rs = "03";
                } else if (parseFloat(hs) == parseFloat(vs)) {
                    rs = "01";
                } else {
                    rs = "00";
                }
            }
        } else if(gid == 88){
            var t = parseFloat(hs) + parseFloat(vs);
            if(t >= 3){//上
                if(t % 2 == 0){//双
                    rs = "2";
                } else {//单
                    rs = "3";
                }
            } else {//下
                if(t % 2 == 0){//双
                    rs = "0";
                } else {//单
                    rs = "1";
                }
            }
        } else if(gid == 89 || gid == 93){
            rs = "" + (parseFloat(hs) + parseFloat(vs));
            if (parseFloat(rs) > 7) {
                rs = "7";
            }
        } else if(gid == 94){
            if(parseFloat(hs) > parseFloat(vs)){
                rs = "3";
            } else if(parseFloat(hs) < parseFloat(vs)){
                rs = "0";
            }
        } else if(gid == 95){
            if(parseFloat(hs) + parseFloat(lose) > parseFloat(vs)){
                rs = "3";
            } else if(parseFloat(hs) + parseFloat(lose) < parseFloat(vs)){
                rs = "0";
            }
        } else if(gid == 96){
            var val = parseInt(hs) - parseInt(vs);
            if (val > 0) {
                if(val > 0 & val <=5){
                    rs = "01";
                } else if (val > 5 & val <=10){
                    rs = "02";
                } else if (val > 10 & val <=15){
                    rs = "03";
                } else if (val > 15 & val <=20){
                    rs = "04";
                } else if (val > 20 & val <=25){
                    rs = "05";
                } else {
                    rs = "06";
                }
            } else {
                val = Math.abs(val);
                if(val > 0 & val <=5){
                    rs = "11";
                } else if (val > 5 & val <=10){
                    rs = "12";
                } else if (val > 10 & val <=15){
                    rs = "13";
                } else if (val > 15 & val <=20){
                    rs = "14";
                } else if (val > 20 & val <=25){
                    rs = "15";
                } else {
                    rs = "16";
                }
            }
        } else if(gid == 97){
            if(parseFloat(hs) + parseFloat(vs) > parseFloat(lose)){
                rs = "3";
            } else {
                rs = "0";
            }
        }
        return rs;
    },
}
export const getDate = jsbk.getDate;
export const getMatchRT = jsbk.getMatchRT;
export const getMatchRS = jsbk.getMatchRS;